package com.symbio.ishenapi.background.controller;

import com.symbio.ishenapi.background.model.TmBoutUs;
import com.symbio.ishenapi.common.controller.BaseController;
import io.jboot.web.controller.annotation.RequestMapping;

import java.util.Date;
import java.util.Map;

@RequestMapping("/tmBoutUsController")
public class TmBoutUsController extends BaseController {

    /**
     * @Author jianghy
     * @Description 平台配置-关于我们回显 医生患者端
     * @date
     * @return void
     */
    public void queryBoutUsInfo(){
        String  doctorPatientClient = getPara("doctorPatientClient");
        if(!"".equals(doctorPatientClient)||doctorPatientClient !=null){
            Map map = TmBoutUs.dao.queryBoutUsInfo(doctorPatientClient);
            renderJson(map);
        }
    }
    /**
     * @Author jianghy
     * @Description 平台配置-关于我们信息修改
     * @date
     * @return void
     */
    public void updateBoutUsInfo(){
        TmBoutUs bup = (TmBoutUs)getReqBodyObject(TmBoutUs.class);
        int count = TmBoutUs.dao.updateInfoStatus(bup.getDoctorPatientClient());
        if(count>=0){//修改以前数据状态为无效
            bup.setStatus(1);
            bup.setCreateTime(new Date());
            if(bup.save()){//保存最新数据
                renderJsonRet(40001);
            }else{
                renderJsonError(40002);
            }
        }else{
            renderJsonError(40002);
        }

    }
}
